package longrise.phone.com.bjjt_jyb.updata;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextPaint;
import android.util.AttributeSet;
import android.widget.ProgressBar;

public class DownloadDialog extends ProgressBar{
//	String text;
	Paint paint;
	public DownloadDialog(Context context) {
		super(context);
		initText();
	}
	
	public DownloadDialog(Context context,AttributeSet attrs) {
		super(context,attrs);
		initText();
	}
	
	public DownloadDialog(Context context,AttributeSet attrs,int defStyle) {
		super(context,attrs,defStyle);
		initText();
	}

	@Override
	public synchronized void setProgress(int progress) {
		super.setProgress(progress);
//		setText(progress);
	}
	
	@Override
	protected synchronized void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		/*Rect rect = new Rect();
		this.paint.getTextBounds(this.text, 0, this.text.length(), rect);
		int x = (getWidth()/2) - rect.centerX();
		int y = (getHeight()/2) - rect.centerY();
		canvas.drawText(this.text, x, y, this.paint);*/
	}
	
	private void initText()
	{
		this.paint = new TextPaint();
		this.paint.setColor(Color.BLACK);
		this.paint.setTextSize(20);
	}
	
	public void setTextSize(float size)
	{
		this.paint.setTextSize(size);
	}
	
//	private void setText(int progress)
//	{
//		int i = (progress * 100)/this.getMax();
//		this.text = String.valueOf(i) + "%";
//	}
}
